home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
-
- public class ProgressMonitor {
- private ProgressMonitor root;
- private JDialog dialog;
- private JOptionPane pane;
- private JProgressBar myBar;
- private JLabel noteLabel;
- private Component parentComponent;
- private String note;
- private Object[] cancelOption;
- private Object message;
- // $FF: renamed from: T0 long
- private long field_0;
- private int millisToDecideToPopup;
- private int millisToPopup;
- private int min;
- private int max;
- // $FF: renamed from: v int
- private int field_1;
- private int lastDisp;
- private int reportDelta;
-
- public ProgressMonitor(Component var1, Object var2, String var3, int var4, int var5) {
- this(var1, var2, var3, var4, var5, (ProgressMonitor)null);
- }
-
- private ProgressMonitor(Component var1, Object var2, String var3, int var4, int var5, ProgressMonitor var6) {
- this.cancelOption = null;
- this.millisToDecideToPopup = 500;
- this.millisToPopup = 2000;
- this.min = var4;
- this.max = var5;
- this.parentComponent = var1;
- this.cancelOption = new Object[1];
- this.cancelOption[0] = UIManager.getString("OptionPane.cancelButtonText");
- this.reportDelta = (var5 - var4) / 100;
- if (this.reportDelta < 1) {
- this.reportDelta = 1;
- }
-
- this.field_1 = var4;
- this.message = var2;
- this.note = var3;
- if (var6 != null) {
- this.root = var6.root != null ? var6.root : var6;
- this.field_0 = this.root.field_0;
- this.dialog = this.root.dialog;
- } else {
- this.field_0 = System.currentTimeMillis();
- }
-
- }
-
- // $FF: synthetic method
- static Object[] access$0(ProgressMonitor var0) {
- return var0.cancelOption;
- }
-
- public void close() {
- if (this.dialog != null) {
- this.dialog.setVisible(false);
- this.dialog.dispose();
- this.dialog = null;
- this.pane = null;
- this.myBar = null;
- }
-
- }
-
- public int getMaximum() {
- return this.max;
- }
-
- public int getMillisToDecideToPopup() {
- return this.millisToDecideToPopup;
- }
-
- public int getMillisToPopup() {
- return this.millisToPopup;
- }
-
- public int getMinimum() {
- return this.min;
- }
-
- public String getNote() {
- return this.note;
- }
-
- public boolean isCanceled() {
- if (this.pane == null) {
- return false;
- } else {
- Object var1 = this.pane.getValue();
- return var1 != null && this.cancelOption.length == 1 && var1.equals(this.cancelOption[0]);
- }
- }
-
- public void setMaximum(int var1) {
- this.max = var1;
- }
-
- public void setMillisToDecideToPopup(int var1) {
- this.millisToDecideToPopup = var1;
- }
-
- public void setMillisToPopup(int var1) {
- this.millisToPopup = var1;
- }
-
- public void setMinimum(int var1) {
- this.min = var1;
- }
-
- public void setNote(String var1) {
- this.note = var1;
- if (this.noteLabel != null) {
- this.noteLabel.setText(var1);
- }
-
- }
-
- public void setProgress(int var1) {
- this.field_1 = var1;
- if (var1 >= this.max) {
- this.close();
- } else if (var1 >= this.lastDisp + this.reportDelta) {
- this.lastDisp = var1;
- if (this.myBar != null) {
- this.myBar.setValue(var1);
- } else {
- long var2 = System.currentTimeMillis();
- long var4 = (long)((int)(var2 - this.field_0));
- if (var4 >= (long)this.millisToDecideToPopup) {
- int var6;
- if (var1 > this.min) {
- var6 = (int)(var4 * (long)(this.max - this.min) / (long)(var1 - this.min));
- } else {
- var6 = this.millisToPopup;
- }
-
- if (var6 >= this.millisToPopup) {
- this.myBar = new JProgressBar();
- this.myBar.setMinimum(this.min);
- this.myBar.setMaximum(this.max);
- this.myBar.setValue(var1);
- if (this.note != null) {
- this.noteLabel = new JLabel(this.note);
- }
-
- this.pane = new ProgressOptionPane(this, new Object[]{this.message, this.noteLabel, this.myBar});
- this.dialog = this.pane.createDialog(this.parentComponent, "Progress...");
- this.dialog.show();
- }
- }
- }
- }
-
- }
- }
-